/*
 Navicat MySQL Data Transfer

 Source Server         : localhost_3306
 Source Server Type    : MySQL
 Source Server Version : 80028
 Source Host           : localhost:3306
 Source Schema         : blog_back

 Target Server Type    : MySQL
 Target Server Version : 80028
 File Encoding         : 65001

 Date: 20/10/2022 11:31:27
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for article
-- ----------------------------
DROP TABLE IF EXISTS `article`;
CREATE TABLE `article` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL COMMENT '作者',
  `filename` varchar(127) NOT NULL COMMENT '相对系统存储的文件名',
  `tag_ids` json NOT NULL COMMENT '标签的JSON array',
  `headline` varchar(63) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标题',
  `outline` varchar(127) DEFAULT '' COMMENT '摘要',
  `cover_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '封面',
  `status` enum('1','0') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '文章是否有用',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`,`user_id`) USING BTREE,
  KEY `user_id` (`user_id`),
  CONSTRAINT `ariticle_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='文章表';

-- ----------------------------
-- Table structure for brand
-- ----------------------------
DROP TABLE IF EXISTS `brand`;
CREATE TABLE `brand` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '品牌名称',
  `cover_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '品牌封面',
  `market_price` int unsigned DEFAULT NULL COMMENT '市场价',
  `stock` int unsigned NOT NULL DEFAULT '0' COMMENT '库存',
  `status` enum('1','0') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '品牌是否有效',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Table structure for collection
-- ----------------------------
DROP TABLE IF EXISTS `collection`;
CREATE TABLE `collection` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int unsigned NOT NULL COMMENT '用户',
  `article_id` int unsigned NOT NULL COMMENT '文章',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`,`user_id`,`article_id`) USING BTREE,
  KEY `user_id` (`user_id`),
  KEY `article_id` (`article_id`),
  CONSTRAINT `collection_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
  CONSTRAINT `collection_ibfk_2` FOREIGN KEY (`article_id`) REFERENCES `article` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='收藏表';

-- ----------------------------
-- Table structure for inventory_history
-- ----------------------------
DROP TABLE IF EXISTS `inventory_history`;
CREATE TABLE `inventory_history` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `brand_id` int unsigned NOT NULL COMMENT '品牌Id',
  `customer_id` int unsigned DEFAULT NULL COMMENT '顾客id',
  `type` enum('-1','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '-1出库，1入库',
  `price` int unsigned NOT NULL COMMENT '出库/入库 实际总价格',
  `nub` int unsigned NOT NULL COMMENT '数量',
  `marketPrice` int DEFAULT NULL COMMENT '品牌当时的价格',
  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`,`brand_id`),
  KEY `inventory_history_ibfk_1` (`brand_id`),
  CONSTRAINT `inventory_history_ibfk_1` FOREIGN KEY (`brand_id`) REFERENCES `brand` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Table structure for permission
-- ----------------------------
DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `id_path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '节点路径',
  `type` enum('1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '1' COMMENT '节点归属类型',
  `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '权限名称',
  `zn_name` varchar(64) NOT NULL COMMENT '权限中文中文',
  `func_type` enum('1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '菜单还是按钮',
  `page_url` varchar(255) DEFAULT NULL COMMENT '页面节点的路径',
  `api_list` json NOT NULL COMMENT '节点的接口校验',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限表';

-- ----------------------------
-- Records of permission
-- ----------------------------
BEGIN;
INSERT INTO `permission` VALUES (1, '', '1', 'SystemManagement', '系统管理', '1', '/system-management', '[]', '2022-07-29 11:10:58', '2022-07-29 11:40:50');
INSERT INTO `permission` VALUES (2, '/1', '1', 'UserManagement', '用户管理', '1', '/system-management/user-management', '[\"GET_/user\", \"GET_/user/:id\"]', '2022-07-29 11:30:36', '2022-07-29 11:30:36');
INSERT INTO `permission` VALUES (3, '/1', '1', 'RoleManagement', '角色管理', '1', '/system-management/role-management', '[\"GET_/role\", \"GET_/role/:id\"]', '2022-07-29 11:31:53', '2022-07-29 11:31:53');
INSERT INTO `permission` VALUES (4, '/1', '1', 'PermissionManagement', '权限管理', '1', '/system-management/permission-management', '[\"GET_/permission\", \"GET_/permission/:id\"]', '2022-07-29 11:32:37', '2022-07-29 11:32:37');
INSERT INTO `permission` VALUES (5, '', '1', 'UserInfoManagement', '信息管理', '1', '/user-info-management', '[]', '2022-07-29 11:40:17', '2022-07-29 11:40:57');
INSERT INTO `permission` VALUES (6, '/1/4', '1', 'PermissionManagementAdd', '添加权限', '2', NULL, '[\"POST_/permission\"]', '2022-07-29 11:43:50', '2022-07-29 11:43:50');
INSERT INTO `permission` VALUES (7, '/1/3', '1', 'RoleManagementUpdate', '更新角色', '2', NULL, '[\"PUT_/role/:id\"]', '2022-07-29 11:43:50', '2022-07-29 11:43:50');
INSERT INTO `permission` VALUES (8, '/1/4', '1', 'PermissionManagementDelete', '删除权限', '2', NULL, '\"[\\\"DELETE_/permission/:id\\\"]\"', '2022-08-15 22:56:07', '2022-08-15 22:56:07');
INSERT INTO `permission` VALUES (9, '/1/4', '1', 'PermissionManagementUpdate', '更新权限', '2', NULL, '\"[\\\"PUT_/permission/:id\\\"]\"', '2022-08-15 22:56:29', '2022-08-15 22:56:29');
INSERT INTO `permission` VALUES (10, '/1/3', '1', 'RoleManagementAdd', '添加角色', '2', NULL, '\"[\\\"POST_/role\\\"]\"', '2022-08-15 22:57:26', '2022-08-15 22:57:26');
INSERT INTO `permission` VALUES (11, '/1/3', '1', 'RoleManagementDelete', '删除角色', '2', NULL, '\"[\\\"DELETE_/role/:id\\\"]\"', '2022-08-15 22:58:32', '2022-08-15 22:58:32');
INSERT INTO `permission` VALUES (12, '/1/2', '1', 'UserManagementAdd', '添加用户', '2', NULL, '\"[\\\"POST_/user\\\"]\"', '2022-08-15 22:59:33', '2022-08-15 22:59:33');
INSERT INTO `permission` VALUES (13, '/1/2', '1', 'UserManagementUpdate', '更新用户', '2', NULL, '\"[\\\"PUT_/user/:id\\\"]\"', '2022-08-15 23:00:34', '2022-08-15 23:00:34');
INSERT INTO `permission` VALUES (14, '/5', '1', 'UserInfoManagementInfoUpdate', '更新信息', '2', NULL, '\"[\\\"PUT_/user/base_info\\\"]\"', '2022-10-03 15:02:45', '2022-10-03 15:02:45');
INSERT INTO `permission` VALUES (15, '/5', '1', 'UserInfoManagementPasswordUpdate', '更新密码', '2', NULL, '\"[\\\"PUT_/user/password\\\"]\"', '2022-10-03 15:05:49', '2022-10-03 15:05:49');
INSERT INTO `permission` VALUES (16, '', '1', 'BrandManagement', '品牌管理', '1', '/brand-management', '[\"GET_/brand\"]', '2022-10-03 18:32:45', '2022-10-04 08:58:53');
INSERT INTO `permission` VALUES (17, '/16', '1', 'BrandManagementCreate', '创建品牌', '2', NULL, '\"[\\\"POST_/brand\\\"]\"', '2022-10-03 18:32:57', '2022-10-03 18:32:57');
INSERT INTO `permission` VALUES (18, '/16', '1', 'BrandManagementUpdate', '更新品牌', '2', NULL, '[\"PUT_/brand/:id\"]', '2022-10-03 18:33:11', '2022-10-04 18:24:16');
INSERT INTO `permission` VALUES (19, '', '1', 'InventoryHistoryManagement', '库存记录管理', '1', '/inventory-history', '\"[\\\"GET_/inventory-history\\\"]\"', '2022-10-04 08:49:45', '2022-10-04 08:49:45');
INSERT INTO `permission` VALUES (20, '/19', '1', 'InventoryHistoryManagementCreate', '创建库存记录', '2', NULL, '\"[\\\"POST_/inventory-history\\\"]\"', '2022-10-04 08:49:56', '2022-10-04 08:49:56');
INSERT INTO `permission` VALUES (21, '/19', '1', 'InventoryHistoryManagementUpdate', '更新库存记录', '2', NULL, '\"[\\\"PUT_/inventory-history/:id\\\"]\"', '2022-10-04 08:50:05', '2022-10-04 08:50:05');
INSERT INTO `permission` VALUES (22, '/16', '1', 'BrandManagementDelete', '删除品牌', '2', NULL, '\"[\\\"DELETE_/brand/:id\\\"]\"', '2022-10-04 08:51:08', '2022-10-04 08:51:08');
INSERT INTO `permission` VALUES (23, '/19', '1', 'InventoryHistoryManagementDelete', '删除库存记录', '2', NULL, '\"[\\\"DELETE_/inventory-history/:id\\\"]\"', '2022-10-04 08:51:41', '2022-10-04 08:51:41');
COMMIT;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `isSuper` enum('1','0') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '是否为超级管理员',
  `name` varchar(32) NOT NULL COMMENT '角色名称',
  `zn_name` varchar(64) NOT NULL COMMENT '角色中文名称',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色表';

-- ----------------------------
-- Records of role
-- ----------------------------
BEGIN;
INSERT INTO `role` VALUES (1, '1', 'superAdmin', '超级管理员', '2022-02-21 15:19:27', '2022-10-20 11:31:00');
INSERT INTO `role` VALUES (2, '0', 'commonUser', '普通用户', '2022-02-21 15:19:27', '2022-07-29 17:17:08');
COMMIT;

-- ----------------------------
-- Table structure for role_permission
-- ----------------------------
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission` (
  `role_id` int unsigned NOT NULL COMMENT '角色外键id',
  `permission_id` int unsigned NOT NULL COMMENT '权限外键id',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`role_id`,`permission_id`) USING BTREE,
  KEY `role_id` (`role_id`),
  KEY `permission_id` (`permission_id`),
  CONSTRAINT `role_permission_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
  CONSTRAINT `role_permission_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `permission` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色_权限表';

-- ----------------------------
-- Records of role_permission
-- ----------------------------
BEGIN;
INSERT INTO `role_permission` VALUES (2, 5, '2022-08-16 09:51:18', '2022-08-16 09:51:18');
COMMIT;

-- ----------------------------
-- Table structure for tag
-- ----------------------------
DROP TABLE IF EXISTS `tag`;
CREATE TABLE `tag` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(63) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `cover_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of tag
-- ----------------------------
BEGIN;
INSERT INTO `tag` VALUES (1, 'javascript', 'https://th.wallhaven.cc/small/g8/g83qpe.jpg', '2020-07-03 23:52:46', '2020-10-18 14:55:44');
INSERT INTO `tag` VALUES (2, 'css', 'https://th.wallhaven.cc/small/q6/q6w355.jpg', '2020-07-03 23:52:46', '2020-10-18 14:59:34');
INSERT INTO `tag` VALUES (3, 'vue.js', 'https://th.wallhaven.cc/small/g8/g83m3d.jpg', '2020-07-03 23:52:46', '2020-10-18 14:46:54');
INSERT INTO `tag` VALUES (4, 'html5', 'https://th.wallhaven.cc/small/83/83lq62.jpg', '2020-07-03 23:52:46', '2020-10-18 14:47:05');
INSERT INTO `tag` VALUES (5, 'node.js', 'https://th.wallhaven.cc/small/xl/xlx8ez.jpg', '2020-07-03 23:52:46', '2020-10-18 14:47:15');
INSERT INTO `tag` VALUES (6, 'react.js', 'https://th.wallhaven.cc/small/vg/vg7lv3.jpg', '2020-07-03 23:52:46', '2020-10-18 14:59:14');
INSERT INTO `tag` VALUES (7, 'css3', 'https://th.wallhaven.cc/small/ox/oxkjgm.jpg', '2020-07-03 23:52:46', '2020-10-18 14:47:48');
INSERT INTO `tag` VALUES (8, 'typescript', 'https://th.wallhaven.cc/small/dg/dgl9pj.jpg', '2020-07-03 23:52:46', '2020-10-18 14:55:12');
INSERT INTO `tag` VALUES (9, 'es6+', 'https://th.wallhaven.cc/small/zm/zml1ly.jpg', '2020-07-03 23:52:46', '2020-10-18 14:48:37');
INSERT INTO `tag` VALUES (10, 'java', 'https://th.wallhaven.cc/small/83/832gvy.jpg', '2020-07-03 23:52:46', '2020-10-18 14:52:58');
INSERT INTO `tag` VALUES (11, 'php', 'https://th.wallhaven.cc/small/g8/g8oomq.jpg', '2020-07-03 23:52:46', '2020-10-18 14:49:04');
INSERT INTO `tag` VALUES (12, 'node.js', 'https://th.wallhaven.cc/small/g8/g83j57.jpg', '2020-07-03 23:52:46', '2020-10-18 14:49:06');
INSERT INTO `tag` VALUES (13, 'python', 'https://th.wallhaven.cc/small/39/39dxld.jpg', '2020-07-03 23:52:46', '2020-10-18 14:49:45');
INSERT INTO `tag` VALUES (14, 'C++', 'https://th.wallhaven.cc/small/xl/xlxlw3.jpg', '2020-07-03 23:52:46', '2020-10-18 14:49:48');
INSERT INTO `tag` VALUES (15, 'C语言', 'https://th.wallhaven.cc/small/2e/2erpog.jpg', '2020-07-03 23:52:46', '2020-10-18 14:50:01');
INSERT INTO `tag` VALUES (16, 'C#', 'https://th.wallhaven.cc/small/ey/eydyx8.jpg', '2020-07-03 23:52:46', '2020-10-18 14:50:09');
INSERT INTO `tag` VALUES (17, 'spring', 'https://th.wallhaven.cc/small/ym/ymyzex.jpg', '2020-07-03 23:52:46', '2020-10-18 14:50:16');
INSERT INTO `tag` VALUES (18, 'mysql', 'https://th.wallhaven.cc/small/83/832grj.jpg', '2020-07-03 23:52:46', '2020-10-18 14:58:16');
INSERT INTO `tag` VALUES (19, 'redis', 'https://th.wallhaven.cc/small/xl/xlx51z.jpg', '2020-07-03 23:52:46', '2020-10-18 14:57:27');
INSERT INTO `tag` VALUES (20, 'mongodb', 'https://th.wallhaven.cc/small/zm/zmlw7y.jpg', '2020-07-03 23:52:46', '2020-10-18 14:52:13');
INSERT INTO `tag` VALUES (21, 'sql', 'https://th.wallhaven.cc/small/ym/ymyzex.jpg', '2020-07-03 23:52:46', '2020-10-18 14:51:37');
INSERT INTO `tag` VALUES (22, 'nosql', 'https://th.wallhaven.cc/small/kw/kwm9o7.jpg', '2020-07-03 23:52:46', '2020-10-18 14:51:19');
INSERT INTO `tag` VALUES (23, 'flutter', 'https://w.wallhaven.cc/full/kw/wallhaven-kwm9o7.jpg', '2020-07-03 23:52:46', '2020-10-18 12:53:46');
INSERT INTO `tag` VALUES (24, 'linux', 'http://pic.netbian.com/uploads/allimg/201028/223855-160389593510f0.jpg', '2020-12-18 14:51:03', '2020-12-18 14:56:32');
INSERT INTO `tag` VALUES (25, 'window', 'http://pic.netbian.com/uploads/allimg/200928/233820-1601307500bead.jpg', '2020-12-18 14:51:23', '2020-12-18 14:56:53');
INSERT INTO `tag` VALUES (26, 'ios', 'http://pic.netbian.com/uploads/allimg/200916/223521-16002669215c26.jpg', '2020-12-18 14:51:29', '2020-12-18 14:57:45');
INSERT INTO `tag` VALUES (27, 'Android', 'http://pic.netbian.com/uploads/allimg/200807/232918-1596814158f32f.jpg', '2020-12-18 14:52:12', '2020-12-18 14:58:35');
INSERT INTO `tag` VALUES (28, '队列', 'http://pic.netbian.com/uploads/allimg/200623/235323-15929276039111.jpg', '2020-12-18 14:52:31', '2020-12-18 14:58:36');
INSERT INTO `tag` VALUES (29, '链表', 'http://pic.netbian.com/uploads/allimg/200527/233932-15905939722e02.jpg', '2020-12-18 14:52:39', '2020-12-18 14:59:07');
INSERT INTO `tag` VALUES (30, '图', 'http://pic.netbian.com/uploads/allimg/200503/220650-1588514810637e.jpg', '2020-12-18 14:52:50', '2020-12-18 14:59:49');
INSERT INTO `tag` VALUES (31, '递归', 'http://pic.netbian.com/uploads/allimg/200121/233900-1579621140529f.jpg', '2020-12-18 14:52:58', '2020-12-18 15:00:53');
INSERT INTO `tag` VALUES (32, '树', 'http://pic.netbian.com/uploads/allimg/191221/211548-1576934148247a.jpg', '2020-12-18 14:53:18', '2020-12-18 15:01:28');
INSERT INTO `tag` VALUES (33, 'http', 'http://pic.netbian.com/uploads/allimg/191214/191808-15763222886f55.jpg', '2020-12-18 14:54:25', '2020-12-18 15:01:30');
INSERT INTO `tag` VALUES (34, 'https', 'http://pic.netbian.com/uploads/allimg/191025/232625-157201718535dc.jpg', '2020-12-18 14:54:37', '2020-12-18 15:02:02');
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `username` varchar(31) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
  `password` varchar(63) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
  `nickname` varchar(255) DEFAULT NULL COMMENT '用户昵称',
  `avatar_image` varchar(255) DEFAULT NULL COMMENT '头像',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES (1, '2020974511@qq.com', 'admin', 'admin', '超管', 'https://common-iamge-1302770950.cos.ap-guangzhou.myqcloud.com/authority/06854ddb1c348c8cd51f90afdfed5838ee0bc8e2ab2e28c445398c890ff9805c.jpeg', '2022-08-13 19:23:11', '2022-10-03 15:06:52');
INSERT INTO `user` VALUES (2, '2020974511@qq.com', 'shepijcanwu', 'a9848057-3978-415f-9f12-848d757df7a1', '蛇皮鸡', NULL, '2022-08-16 09:55:57', '2022-08-16 09:55:57');
COMMIT;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `user_id` int unsigned NOT NULL COMMENT '用户外键id',
  `role_id` int unsigned NOT NULL COMMENT '角色外键id',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`role_id`,`user_id`) USING BTREE,
  KEY `user_id` (`user_id`),
  KEY `role_id` (`role_id`),
  CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
  CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户_角色表';

-- ----------------------------
-- Records of user_role
-- ----------------------------
BEGIN;
INSERT INTO `user_role` VALUES (1, 1, '2022-08-13 19:23:11', '2022-08-13 19:23:11');
INSERT INTO `user_role` VALUES (2, 2, '2022-08-16 09:55:57', '2022-08-16 09:55:57');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
